local baijia = fk.CreateSkill {
  name = "rmt__baijia",
  tags = { Skill.Wake },
}

Fk:loadTranslationTable{
  ["rmt__baijia"] = "拜假",
  [":rmt__baijia"] = "觉醒技，准备阶段开始时，若你因〖骨疽〗获得牌不小于7张，则你加1点体力上限，回复1点体力，" ..
  "然后令所有未拥有“傀”的其他角色获得一枚“傀”，最后失去〖骨疽〗，并获得〖蚕食〗。",

  ["$rmt__baijia1"] = "没有人能阻止我的觉醒。",
  ["$rmt__baijia2"] = "哼哼哼……这才是我的真面目。",
}

baijia:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return
      target == player and
      player:hasSkill(baijia.name) and
      player.phase == Player.Start and
      player:usedSkillTimes(baijia.name, Player.HistoryGame) == 0
  end,
  can_wake = function(self, event, target, player, data)
    return player:getMark("@rmt__guju") > 6
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player, "@rmt__guju", 0)
    room:changeMaxHp(player, 1)
    room:recover{
      who = player,
      num = 1,
      recoverBy = player,
      skillName = baijia.name,
    }
    table.forEach(room:getOtherPlayers(player, false), function(p)
      if p:getMark("@@rmt__puppet") == 0 then
        room:addPlayerMark(p, "@@rmt__puppet")
      end
    end)
    room:handleAddLoseSkills(player, "rmt__canshi|-rmt__guju")
  end,
})

return baijia
